home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / var / lib / dpkg / info / module-init-tools.postrm < prev    next >
Text File  |  2009-09-15  |  5KB  |  184 lines

  1. #!/bin/sh -e
  2. # This script can be called in the following ways:
  3. #
  4. # After the package was removed:
  5. #    <postrm> remove
  6. #
  7. # After the package was purged:
  8. #    <postrm> purge
  9. #
  10. # After the package was upgraded:
  11. #    <old-postrm> upgrade <new-version>
  12. # if that fails:
  13. #    <new-postrm> failed-upgrade <old-version>
  14. #
  15. #
  16. # After all of the packages files have been replaced:
  17. #    <postrm> disappear <overwriting-package> <version>
  18. #
  19. #
  20. # If preinst fails during install:
  21. #    <new-postrm> abort-install
  22. #
  23. # If preinst fails during upgrade of removed package:
  24. #    <new-postrm> abort-install <old-version>
  25. #
  26. # If preinst fails during upgrade:
  27. #    <new-postrm> abort-upgrade <old-version>
  28.  
  29.  
  30. # Undo removal of a no-longer used conffile
  31. undo_rm_conffile()
  32. {
  33.     CONFFILE="$1"
  34.  
  35.     if [ ! -e "$CONFFILE" ]; then
  36.     if [ -e "$CONFFILE".dpkg-bak ]; then
  37.         echo "Restoring modified conffile $CONFFILE"
  38.         mv -f "$CONFFILE".dpkg-bak "$CONFFILE"
  39.     elif [ -e "$CONFFILE".dpkg-obsolete ]; then
  40.         mv -f "$CONFFILE".dpkg-obsolete "$CONFFILE"
  41.     fi
  42.     fi
  43. }
  44.  
  45. # Finish removal of a no-longer used conffile
  46. finish_rm_conffile()
  47. {
  48.     CONFFILE="$1"
  49.  
  50.     if [ -e "$CONFFILE".dpkg-bak ]; then
  51.     rm -f "$CONFFILE".dpkg-bak
  52.     fi
  53. }
  54.  
  55. # Undo move of a conffile
  56. undo_mv_conffile()
  57. {
  58.     CONFFILE="$1"
  59.  
  60.     if [ ! -e "$CONFFILE" ]; then
  61.     if [ -e "$CONFFILE".dpkg-bak ]; then
  62.         mv -f "$CONFFILE".dpkg-bak "$CONFFILE"
  63.     elif [ -e "$CONFFILE".dpkg-moving ]; then
  64.         mv -f "$CONFFILE".dpkg-moving "$CONFFILE"
  65.     fi
  66.     fi
  67. }
  68.  
  69. # Finish move of a conffile
  70. finish_mv_conffile()
  71. {
  72.     CONFFILE="$1"
  73.  
  74.     if [ -e "$CONFFILE".dpkg-bak ]; then
  75.     rm -f "$CONFFILE".dpkg-bak
  76.     fi
  77. }
  78.  
  79.  
  80. # Finish migrating config to 3.7-style
  81. finish_migrate_config_37()
  82. {
  83.     finish_rm_conffile /etc/modprobe.d/aliases
  84.     finish_rm_conffile /etc/modprobe.d/isapnp
  85.     finish_rm_conffile /etc/modprobe.d/options
  86.  
  87.     finish_rm_conffile /etc/modprobe.d/arch/alpha
  88.     finish_rm_conffile /etc/modprobe.d/arch/i386
  89.     finish_rm_conffile /etc/modprobe.d/arch/ia64
  90.     finish_rm_conffile /etc/modprobe.d/arch/m68k.amiga
  91.     finish_rm_conffile /etc/modprobe.d/arch/m68k.atari
  92.     finish_rm_conffile /etc/modprobe.d/arch/m68k.generic
  93.     finish_rm_conffile /etc/modprobe.d/arch/mips
  94.     finish_rm_conffile /etc/modprobe.d/arch/parisc
  95.     finish_rm_conffile /etc/modprobe.d/arch/powerpc.apus
  96.     finish_rm_conffile /etc/modprobe.d/arch/powerpc.generic
  97.     finish_rm_conffile /etc/modprobe.d/arch/powerpc.pmac
  98.     finish_rm_conffile /etc/modprobe.d/arch/s390
  99.     finish_rm_conffile /etc/modprobe.d/arch/sparc
  100.     finish_rm_conffile /etc/modprobe.d/arch/x86_64
  101.  
  102.     finish_rm_conffile /etc/modprobe.d/blacklist-amd76-edac
  103.     finish_mv_conffile /etc/modprobe.d/blacklist \
  104.                /etc/modprobe.d/blacklist.conf
  105.     finish_mv_conffile /etc/modprobe.d/blacklist-firewire \
  106.                /etc/modprobe.d/blacklist-firewire.conf
  107.     finish_mv_conffile /etc/modprobe.d/blacklist-framebuffer \
  108.                /etc/modprobe.d/blacklist-framebuffer.conf
  109.     finish_mv_conffile /etc/modprobe.d/blacklist-watchdog \
  110.                /etc/modprobe.d/blacklist-watchdog.conf
  111. }
  112.  
  113. # Undo migrating config to 3.7-style
  114. undo_migrate_config_37()
  115. {
  116.     undo_rm_conffile /etc/modprobe.d/aliases
  117.     undo_rm_conffile /etc/modprobe.d/isapnp
  118.     undo_rm_conffile /etc/modprobe.d/options
  119.  
  120.     undo_rm_conffile /etc/modprobe.d/arch/alpha
  121.     undo_rm_conffile /etc/modprobe.d/arch/i386
  122.     undo_rm_conffile /etc/modprobe.d/arch/ia64
  123.     undo_rm_conffile /etc/modprobe.d/arch/m68k.amiga
  124.     undo_rm_conffile /etc/modprobe.d/arch/m68k.atari
  125.     undo_rm_conffile /etc/modprobe.d/arch/m68k.generic
  126.     undo_rm_conffile /etc/modprobe.d/arch/mips
  127.     undo_rm_conffile /etc/modprobe.d/arch/parisc
  128.     undo_rm_conffile /etc/modprobe.d/arch/powerpc.apus
  129.     undo_rm_conffile /etc/modprobe.d/arch/powerpc.generic
  130.     undo_rm_conffile /etc/modprobe.d/arch/powerpc.pmac
  131.     undo_rm_conffile /etc/modprobe.d/arch/s390
  132.     undo_rm_conffile /etc/modprobe.d/arch/sparc
  133.     undo_rm_conffile /etc/modprobe.d/arch/x86_64
  134.  
  135.     undo_rm_conffile /etc/modprobe.d/blacklist-amd76-edac
  136.     undo_mv_conffile /etc/modprobe.d/blacklist \
  137.              /etc/modprobe.d/blacklist.conf
  138.     undo_mv_conffile /etc/modprobe.d/blacklist-firewire \
  139.              /etc/modprobe.d/blacklist-firewire.conf
  140.     undo_mv_conffile /etc/modprobe.d/blacklist-framebuffer \
  141.              /etc/modprobe.d/blacklist-framebuffer.conf
  142.     undo_mv_conffile /etc/modprobe.d/blacklist-watchdog \
  143.              /etc/modprobe.d/blacklist-watchdog.conf
  144. }
  145.  
  146.  
  147.  
  148. # Remove configuration
  149. purge_files()
  150. {
  151.     if [ -f /etc/modules ]; then
  152.     rm -f /etc/modules
  153.     fi
  154. }
  155.  
  156.  
  157. case "$1" in
  158.     remove)
  159.     ;;
  160.  
  161.     purge)
  162.     finish_migrate_config_37
  163.     purge_files
  164.     ;;
  165.  
  166.     upgrade|failed-upgrade|disappear)
  167.     ;;
  168.  
  169.     abort-install|abort-upgrade)
  170.     # Abort upgrade from intrepid
  171.     if dpkg --compare-versions "$2" lt "3.7~pre7-1"; then
  172.         undo_migrate_config_37
  173.     fi
  174.     ;;
  175.  
  176.     *)
  177.     echo "$0 called with unknown argument \`$1'" 1>&2
  178.     exit 1
  179.     ;;
  180. esac
  181.  
  182.  
  183. exit 0
  184.